﻿using Ked;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UnitTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        private void cmdUpload_Click(object sender, EventArgs e)
        {
            OpenFileDialog o1 = new OpenFileDialog();
            o1.ShowDialog();
            string path = o1.FileName;
            if (!File.Exists(path))
            {
                MessageBox.Show("path:" + path + "\ndoes not exist");
                return;
            }
            byte[] data = File.ReadAllBytes(path);
            string fileName = Path.GetFileName(path);
            if (MessageBox.Show("upload:" + fileName + "\nremote dir:" + txtRemoteDir.Text, "confirm", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                txtResult.Text = Ked.Ked.PostToKSKX(Path.GetFileName(path), data, txtRemoteDir.Text);
            }
        }
    }
}
